package com.senthink.gl.business.auth;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * Created by lenovo on 2017/11/22.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "用户数据对象")
@Data
public class UpdateUserRequest {

    /**
     * 用户唯一id
     */
    @NotBlank(message = "{user.uid.notBlank}", groups = {FindOneGroup.class, UpdateOneGroup.class, DeleteOneGroup.class, EnableOneGroup.class})
    @ApiModelProperty(value = "用户唯一id")
    private String uid;

    /**
     * 姓名
     */
    @NotBlank(message = "{user.name.notBlank}", groups = {FindOneGroup.class, UpdateOneGroup.class})
    @Size(min = 1, max = 20, message = "{user.name.size}")
    @ApiModelProperty(value = "姓名")
    private String name;

    /**
     * 账号
     */
    @NotBlank(message = "{user.account.notBlank}", groups = {FindOneGroup.class, UpdateOneGroup.class})
    @Size(min = 1, max = 60, message = "{user.account.size}")
    @ApiModelProperty(value = "账号")
    private String account;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    private String password;

    /**
     * 手机号
     */
    @NotBlank(message = "{user.mobile.notBlank}", groups = {FindOneGroup.class, UpdateOneGroup.class})
    @Pattern(regexp = "^1[34578]\\d{9}$", message = "{user.mobile.pattern}")
    @ApiModelProperty(value = "手机号")
    private String mobile;


    /**
     * 角色
     */
    @ApiModelProperty(value = "角色")
    private String role;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String remarks;


    @NotNull(groups = {EnableOneGroup.class})
    @ApiModelProperty(value = "是否禁用")
    private boolean enable;

    private String aid;

    public interface FindOneGroup {
    }

    public interface DeleteOneGroup {
    }

    public interface UpdateOneGroup {
    }
    public interface EnableOneGroup{}
}
